package org.anno.chunkdb;

import java.io.IOException;

/**
 * Supports Query evaluation for a bound column over some chunk of rows, which are numbered
 * consecutively starting with zero.
 */
public interface ColumnQuerySupport {

  /**
   * Reads the value stored in the given row at the bound column and calls one of the {@link
   * TypedCellVisitor#visit} variants.
   */
  void acceptForRow(int row, TypedCellVisitor visitor);

  /**
   * Searches index using binary search. Returns first rank of the search key -- the count of rows
   * that have a strictly smaller value in the bound column.
   */
  int getRank(byte[] rhs) throws IOException;

  /**
   *
   * @param rank
   * @return
   */
  int getRowAtRank(int rank);


  /**
   * Appends some useful information to the given buffer.
   */
  void appendDebugString(StringBuilder buf);
}
